package org.easyelf.springmvc.core.interceptor;

/**
 * @Title: 日志拦截器
 * @Description:
 * @Package: org.easyelf.springmvc.core.base with IntelliJ IDEA
 * @User: RehngaO
 * @Date: 2017-03-13
 * @Time: 下午2:25
 */

//TODO 还没想好具体实现嵌入方式，先注释
public class EventInterceptor extends BaseInterceptor {
//    @Autowired
//    private SysEventService sysEventService;
//
//    private final ThreadLocal<Long> startTimeThreadLocal = new NamedThreadLocal<Long>("ThreadLocal StartTime");
//
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
//        throws Exception {
//        // 开始时间（该数据只有当前请求的线程可见）
//        startTimeThreadLocal.set(System.currentTimeMillis());
//        return super.preHandle(request, response, handler);
//    }
//
//    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
//        throws Exception {
//        // 保存日志
//        sysEventService.saveEvent(request, response, ex, startTimeThreadLocal.get(), System.currentTimeMillis());
//        super.afterCompletion(request, response, handler, ex);
//    }
}
